<template>
	<!-- 店铺详情营业执照图片 -->
	<view>
		<view class="top" @click="Lookimg(image)" v-if="flag">
			<image :src="image" mode="" style="width: 670rpx;height: 330rpx;margin-top: 10rpx;margin-left: 10rpx;"></image>
		</view>
		<view class="images" v-else>
			<view class="img" v-for="(item,index) in images" :key="index" @click="Lookimg(images)">
				<image :src="item" mode="" style="width: 100%;height: 100%;border-radius: 10rpx;"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				flag : true,
				image:'',
				images:[]
			}
		},
		onLoad(option) {
			if(option.id == 1){
				let arr = option.img.split(',')
				this.flag = false
				this.images = [...arr]
			}else{
				this.image = option.img
			}
			
			
		},
		methods:{
			Lookimg(img){
				// let img = this.image
				let obj = Object.prototype.toString.call(img)
				let str = ''
				if(obj == '[object String]'){
					str = [img]
				}else if(obj == '[object Array]'){
					str = [...img]
				}
				uni.previewImage({
									urls: str, //需要预览的图片http链接列表，多张的时候，url直接写在后面就行了
									current: '', // 当前显示图片的http链接，默认是第一个
									success: function(res) {},
									fail: function(res) {},
									complete: function(res) {},
				})
			},
		}
	}
</script>

<style>
	
	.top{
		width: 690rpx;
		height: 350rpx;
		margin-top: 30rpx;
		margin-left: 30rpx;
		background-color: white;
		border-radius: 16rpx;
		/* border: 1px red solid; */
	}
	.images{
		width: 690rpx;
		/* height: 350rpx; */
		margin-top: 30rpx;
		margin-left: 30rpx;
		background-color: white;
		border-radius: 16rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		flex-wrap: wrap;
		padding: 10rpx;
	}
	.img{
		width: 330rpx;
		height: 330rpx;
		border-radius: 10rpx;
		margin-top: 10rpx;
	}
</style>